home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / fgl105c.zip / 09-12.C < prev    next >
Text File  |  1991-05-05  |  1KB  |  43 lines

  1. #include <stdio.h>
  2.  
  3. char pixel_runs[20000];
  4.  
  5. main()
  6. {
  7.    long filelength();
  8.    FILE *stream;
  9.    int file_size, run_count;
  10.    int old_mode, new_mode;
  11.  
  12.    new_mode = fg_bestmode(320,200,1);
  13.    if (new_mode < 0 || new_mode == 12) {
  14.       printf("This program requires a 320 ");
  15.       printf("x 200 color graphics mode.\n");
  16.       exit();
  17.       }
  18.  
  19.    old_mode = fg_getmode();
  20.    fg_setmode(new_mode);
  21.  
  22.    stream = fopen("coral.spr","rb");
  23.    file_size = (int)(filelength(fileno(stream)));
  24.    fread(pixel_runs,sizeof(char),file_size,stream);
  25.    fclose(stream);
  26.    run_count = file_size / 2;
  27.    fg_move(0,199);
  28.    fg_display(pixel_runs,run_count,320);
  29.    fg_waitkey();
  30.  
  31.    stream = fopen("coral.ppr","rb");
  32.    file_size = (int)(filelength(fileno(stream)));
  33.    fread(pixel_runs,sizeof(char),file_size,stream);
  34.    fclose(stream);
  35.    run_count = file_size / 3 * 2;
  36.    fg_erase();
  37.    fg_displayp(pixel_runs,run_count,320);
  38.    fg_waitkey();
  39.  
  40.    fg_setmode(old_mode);
  41.    fg_reset();
  42. }
  43.